import 'dart:typed_data';

import 'package:dio/dio.dart';
import 'package:dio_service/src/res/result_data.dart';

import '../interceptor/exception.dart';

typedef HttpErrorCallback = Function(NetErrorResponse res);

abstract class RemoteService {
  Future<NetRes<T>> post<T>(
    final String path, {
    final Map<String, dynamic>? args,
    final bool needForm = false,
    final bool loadding = true,
    final Map<String, dynamic>? headers,
    final T Function(Map<String, dynamic> json)? convert,
  });
  Future<NetRes<T>> get<T>(
    final String path, {
    final Map<String, dynamic>? args,
    final bool needForm = false,
    final bool loadding = true,
    final Map<String, dynamic>? headers,
    final T Function(Map<String, dynamic> json)? convert,
  });
  Future<NetRes<T>> upload<T>(
    final String path, {
    required FormData data,
    final Map<String, dynamic>? args,
    final bool loadding = true,
    final Map<String, dynamic>? headers,
    final T Function(Map<String, dynamic> json)? convert,
  });
  Future<NetRes> download<T>(
    final String path,
    final String savePath, {
    void Function(int, int)? onReceiveProgress,
    final Map<String, dynamic>? args,
  });
  Future<int> getFileSizeFromUrl(String url);
  Future<Uint8List?> getImage(String url);
}
